import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/model/patrol/patrol_task_model.dart';
import 'package:ls_work/sql/protral/patrol_task_point_entity.dart';

import '../../message/message_config.dart';

class OfflinePatrolPointListViewModel extends BaseListViewModel<PatrolTaskPointData>{
  final dynamic taskId;

  var model = PatrolTaskModel();
  OfflinePatrolPointListViewModel(BuildContext context,{required this.taskId}) : super(context);

  @override
  Future<List<PatrolTaskPointData>> requestListData() {
    return model.getTaskPoint(taskId);
  }

  @override
  void onCreated() {
    super.onCreated();
    requestRefresh(showAni: false);
  }

  @override
  void receiveMessage(SendMessageEvent event) {
    super.receiveMessage(event);
    if (event.msgCode == MessageConfig.REFRESH_PATROL) {
      requestRefresh(showAni: false);
    }

  }

}